<?php
/**
 * This is the template for generating the model class of a specified table.
 */

/** @var yii\web\View $this */
/** @var \CuiFox\gii\generators\dictionary\Generator $generator */
/** @var string $className class name */
/** @var string $name name */
/** @var string[] $const list of attribute labels (name => label) */

echo "<?php\n";
?>

namespace <?= $generator->ns ?>;

use Yii;

/**
 * This is the dictionary class for "<?=strtoupper($name) ?>".
 */
class <?= $className ?> extends <?= '\\' . ltrim($generator->baseClass, '\\') . "\n" ?>
{
<?php foreach ($const as $item): ?>
    const <?= "{$item['key']} = {$item['value']};\n" ?>
<?php endforeach; ?>

    /**
     * {@inheritdoc}
     */
    public static function all()
    {
        return [
<?php foreach ($const as $item): ?>
            self::<?=$item['key']?> => <?=$generator->generateString($item['name']) ?>,
<?php endforeach; ?>
        ];
    }
}
